<?php

declare (strict_types=1);

namespace catchAdmin\monitor\command;

use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\facade\Log;
use catcher\Code;
use catcher\platform\OverstockService;

class OverstockOrderCommand extends Command
{
    protected $pid;

    protected function configure()
    {
        // 指令配置
        $this->setName('catch:overstockOrder')
            ->setDescription('get Overstock order online list');
    }

    protected function execute(Input $input, Output $output)
    {
        try {
            $this->executeCommand();
        } catch (\Exception $e) {
            Log::error('OverstockOrderSchedule Error Line:' . $e->getLine());
            Log::error('OverstockOrderSchedule Error Code:' . $e->getCode());
            Log::error('OverstockOrderSchedule Error Message:' . $e->getMessage());
            throw new \Exception($e->getMessage());
        }
    }

    /**
     * 执行 command
     *
     * @time 2021年04月02日
     * @return void
     */
    protected function executeCommand()
    {
        $overstock = new OverstockService();
        // 拉取订单
        $overstock->setShop();
        // 同步orderTemp的订单到ERP系统的order
//        $overstock->syncOrderByAccount([Code::OVERSTOCK]);
    }

}
